﻿using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;

namespace ERP.Web;

public class Program
{
    public static async Task<int> Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);

        builder.Host.AddAppSettingsSecretsJson()
            .UseAutofac()
            .UseSerilog();

        await builder.AddApplicationAsync<ERPWebModule>();

        var app = builder.Build();

        await app.InitializeApplicationAsync();

        await app.RunAsync();
        return 0;
    }
}